package com.zhtkj.ui;

import java.awt.GridLayout;
import java.util.ResourceBundle;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.zhtkj.spring.SpringHolder;

/** 
* @ClassName: Launcher 
* @Description: 程序入口，启动器 
* @author mafeng 
* @date 2017年9月7日 上午9:52:07 
*  
*/
public class Launcher {

	private static JTextArea textArea;
	
	private Launcher() {

	}
	
	public static void setText(String text) {
		if (textArea != null && textArea.getText().length() > 5000) {
			textArea.setText("");
		} else {
			textArea.setText(text + "\n" + textArea.getText());
		}
	}
	
	public static void main(String[] args) throws Exception {
		//初始化spring容器
		SpringHolder.setApplicationContext(new ClassPathXmlApplicationContext("springContext.xml"));
		
		//初始化窗口及其他组件
		JFrame frame = new JFrame();  
        JPanel panel = new JPanel();  
        textArea = new JTextArea();  
          
        panel.setLayout(new GridLayout());  
        panel.add(new JScrollPane(textArea));  
        frame.add(panel);  
        
        frame.setTitle("分析服务程序(济南)V" + ResourceBundle.getBundle("project").getString("project.version"));
        frame.setSize(618, 381);  
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	
}
